﻿<Window x:Class="Sample4.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="24"/>
            <RowDefinition Height="0"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Menu>
            <MenuItem Header="Documents">
                <MenuItem Header="List" ItemsSource="{Binding MyDocuments}">
                    <MenuItem.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Title}"/>
                        </DataTemplate>
                    </MenuItem.ItemTemplate>
                </MenuItem>
                <MenuItem Header="Create New" Click="CreateNewDocument"/>
                <MenuItem Header="Clear List" Click="ClearDocumentsList"/>
            </MenuItem>
        </Menu> 
        <ad:DockingManager x:Name="dockManager" Grid.Row="2" DocumentsSource="{Binding MyDocuments}">
            <ad:ResizingPanel>
                <ad:DockablePane ad:ResizingPanel.ResizeWidth="120">
                    <ad:DockableContent Title="Presets" DefaultElement="{Binding ElementName=presetTreeView}">
                        <TreeView x:Name="presetTreeView" Grid.Row="1" >
                            <TreeViewItem Header="Hello" />
                            <TreeViewItem Header="All People" ItemsSource="{Binding People}"
                                      IsExpanded="True">
                                <TreeViewItem.ItemTemplate>
                                    <HierarchicalDataTemplate ItemsSource="{Binding Subordinates}">
                                        <TextBlock Text="{Binding Name}"/>
                                    </HierarchicalDataTemplate>
                                </TreeViewItem.ItemTemplate>
                            </TreeViewItem>
                        </TreeView>
                    </ad:DockableContent>
                    <ad:DockableContent  Title="Documents">
                        <Border>
                        <ListBox ItemsSource="{Binding MyDocuments}" x:Name="listOfDocuments">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Title}"/>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        </Border>
                    </ad:DockableContent>
                </ad:DockablePane>
                <ad:DocumentPane/>              
            </ad:ResizingPanel>

        </ad:DockingManager>
    </Grid>
</Window>
